import Vue from 'vue'
import Router from 'vue-router'
import Home from './views'
const ExpList = () => import(/* webpackChunkName: "expList" */ './views/expList')
const ExpTemplate = () => import(/* webpackChunkName: "expTemplate" */ './views/expTemplate')
const ExpHistory = () => import(/* webpackChunkName: "expHistory" */ './views/expHistory')
const Notice = () => import(/* webpackChunkName: "notice" */ './views/notice')
const ExpEdit = () => import(/* webpackChunkName: "expEdit" */ './views/expEdit')
const DataTable = () => import(/* webpackChunkName: "dataList" */ './views/data')
const CheckProgress = () => import(/* webpackChunkName: "dataList" */ './views/data/CheckProgress')
const DataSource = () => import(/* webpackChunkName: "dataList" */ './views/data/dataSource')
const ModelList = () => import(/* webpackChunkName: "modelList" */ './views/model')
// const Operations = () => import(/* webpackChunkName: "operations" */ './views/operations')
const OperationsCenter = () => import(/* webpackChunkName: "operations" */ './views/operations/center')
const TaskManage = () => import(/* webpackChunkName: "operations" */ './views/operations/taskManage')
const TaskDetail = () => import(/* webpackChunkName: "operations" */ './views/operations/taskManage/detail')
const TaskBlood = () => import(/* webpackChunkName: "operations" */ './views/operations/taskBlood')
const TaskLogs = () => import(/* webpackChunkName: "operations" */ './views/operations/taskLogs')
const Error403 = () => import(/* webpackChunkName: "error" */ './views/error/403')
const Error404 = () => import(/* webpackChunkName: "error" */ './views/error/404')
const Error500 = () => import(/* webpackChunkName: "error" */ './views/error/500')

Vue.use(Router)

export default new Router({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            name: 'home',
            component: Home,
            redirect: localStorage.getItem('showOps') === '1' ? '/opsCenter' : '/expEdit',
            children: [
                { path: 'expList', name: '实验管理', component: ExpList },
                { path: 'expHistory', name: '实验历史', component: ExpHistory },
                { path: 'notice', name: '消息中心', component: Notice },
                { path: 'expTemplate', name: '实验模板', component: ExpTemplate },
                { path: 'expEdit', name: '实验编辑', component: ExpEdit, meta: { keepAlive: true } },
                { path: 'dataList', name: '数据管理', component: DataTable },
                { path: 'dataSource', name: '数据源管理', component: DataSource },
                { path: 'checkProgress', name: '查看进度', component: CheckProgress },
                { path: 'modelList', name: '模型管理', component: ModelList },
                { path: 'opsCenter', name: '运维中心', component: OperationsCenter },
                { path: 'taskManage', name: '任务管理', component: TaskManage },
                { path: 'taskDetail', name: '任务详情', component: TaskDetail },
                { path: 'taskBlood', name: '任务血缘', component: TaskBlood },
                { path: 'taskLogs', name: '任务日志', component: TaskLogs }
            ]
        },
        { path: '/403', name: '403', component: Error403 },
        { path: '/404', name: '404', component: Error404 },
        { path: '/500', name: '500', component: Error500 }
    ]
})
